/*
 * This file is part of shared-drawing.
 * shared-drawing is free software: you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option )
 * any later version. shared-drawing is distributed in the hope that it will
 * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details.
 * You should have received a copy of the GNU General Public License along with 
 * shared-drawing. If not, see http://www.gnu.org/licenses/.
 */

package shapes;

import primitives.P_Line;
import SharedDrawing.FourCornersShape;

public class Star extends FourCornersShape
{
	private P_Line obj[];
	private int width = 0;
	
	public Star()
	{
		obj = new P_Line[8];
		
		for(int i = 0; i < 8; i++)
		{
			obj[i] = new P_Line();
			 m_composingElements.add(obj[i]);
		}
	}

	@Override
	public void setShape() 
	{
		setCorners();
		
		width = (m_size.x + m_size.y) / 30 + 5;
				
		obj[0].setShape(m_location.x + m_size.x / 2, m_location.y, m_location.x + m_size.x / 2 + width, m_location.y + m_size.y / 2 - width);
		obj[1].setShape(m_location.x + m_size.x / 2 + width, m_location.y + m_size.y / 2 - width, m_location.x + m_size.x, m_location.y + m_size.y / 2);
		obj[2].setShape(m_location.x + m_size.x, m_location.y + m_size.y / 2, m_location.x + m_size.x / 2 + width, m_location.y + m_size.y / 2 + width);
		obj[3].setShape(m_location.x + m_size.x / 2 + width, m_location.y + m_size.y / 2 + width, m_location.x + m_size.x / 2, m_location.y + m_size.y);
		obj[4].setShape(m_location.x + m_size.x / 2, m_location.y + m_size.y, m_location.x + m_size.x / 2 - width, m_location.y + m_size.y / 2 + width);
		obj[5].setShape(m_location.x + m_size.x / 2 - width, m_location.y + m_size.y / 2 + width, m_location.x, m_location.y + m_size.y / 2);
		obj[6].setShape(m_location.x, m_location.y + m_size.y / 2, m_location.x + m_size.x / 2 - width, m_location.y + m_size.y / 2 - width);
		obj[7].setShape(m_location.x + m_size.x / 2 - width, m_location.y + m_size.y / 2 - width, m_location.x + m_size.x / 2, m_location.y);	
	}
}

